package com.example.administrator.acmapp.Fragment;

import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.example.administrator.acmapp.R;
import com.gordonwong.materialsheetfab.MaterialSheetFab;

/**
 * Created by Administrator on 2018/2/1/001.
 */

public class ToolFragment extends android.support.v4.app.Fragment implements View.OnClickListener {

    private com.example.administrator.acmapp.Fragment.Fab fab;
    private View sheetView;
    private View view;
    private ActionBarDrawerToggle drawerToggle;
    private DrawerLayout drawerLayout;
    private MaterialSheetFab materialSheetFab;
    private int statusBarColor;

    public ToolFragment() {

    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.tool_fragment_layout, container, false);
        initUI();
        return view;
    }
    private void initUI() {
        fab = (com.example.administrator.acmapp.Fragment.Fab) view.findViewById(R.id.fab);

        fab.setBackgroundTintList((ColorStateList.valueOf(Color.parseColor("#7fd8bf"))));
        sheetView = view.findViewById(R.id.fab_sheet);
        View overlay = view.findViewById(R.id.overlay);
        int sheetColor = getResources().getColor(R.color.colorMain);
        int fabColor = getResources().getColor(R.color.colorMain);

        // Initialize material sheet FAB
        materialSheetFab = new MaterialSheetFab<>(fab, sheetView, overlay,
                sheetColor, fabColor);

        view.findViewById(R.id.fab_sheet_item_01).setOnClickListener(this);
        view.findViewById(R.id.fab_sheet_item_02).setOnClickListener(this);
        view.findViewById(R.id.fab_sheet_item_03).setOnClickListener(this);
        view.findViewById(R.id.fab_sheet_item_04).setOnClickListener(this);




    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.fab_sheet_item_01:
                Toast.makeText(getActivity(), "fab_sheet_item_01", Toast.LENGTH_SHORT).show();
                materialSheetFab.hideSheet();
                break;
            case R.id.fab_sheet_item_02:
                Toast.makeText(getActivity(), "fab_sheet_item_02", Toast.LENGTH_SHORT).show();
                materialSheetFab.hideSheet();
                break;
            case R.id.fab_sheet_item_03:
                Toast.makeText(getActivity(), "fab_sheet_item_03", Toast.LENGTH_SHORT).show();
                materialSheetFab.hideSheet();
                break;
            case R.id.fab_sheet_item_04:
                Toast.makeText(getActivity(), "fab_sheet_item_04", Toast.LENGTH_SHORT).show();
                materialSheetFab.hideSheet();
                break;


            default:
                break;
        }
    }
}
